let vm = new Vue({
    el: "#app",
    data: {
     
        arr2: [
            { pic: '1.购物车.img/1.jbw.jpg', title: '秋刀鱼/斤', price: 35, cond: 35, num: 1},
            { pic: '1.购物车.img/1.jz.jpg', title: '鲜大带鱼/条', price: 45, cond: 45, num: 1},
            { pic: '1.购物车.img/1.jbw.jpg', title: '鲜活皮皮虾/斤', price: 85, cond: 85, num: 1 },
            // { pic: '1.购物车.img/1.jz.jpg', title: '13-15头鲍鱼/只', price: 60, cond: 60, num: 1 },
        ],
    },

    methods: {
       jian(item){
        if(item.num>1){
            item.num--;
        }
       
         },
         jia(item){
             item.num++;
         },
         clean(){
           this.arr2=[];
         }
       },

    computed: { 
        totalCount() {
            var sum = 0;
            this.arr2.forEach((item) => {
                sum += item.num;
            })
            return sum;
        },
        totalPrice() {
            var sum = 0;
            this.arr2.forEach((item) => {
                sum += item.num *item.price;
            })
            return sum;
        },
       
    }
    

})